a11y: Mark SearchEntry icons as presentational
authorEmmanuele Bassi <ebassi@gnome.org>
Thu, 12 Nov 2020 16:04:30 +0000 (16:04 +0000)
committerEmmanuele Bassi <ebassi@gnome.org>
Thu, 12 Nov 2020 21:46:06 +0000 (21:46 +0000)
While the "clear the search entry" icon behaves like a button, we don't
have any actual action that can trigger it, so let's ignore it.

gtk/gtksearchentry.c

index c3662a0e1ce252dd0f7580cce8241721b47f3729..86338ee3b44a1286ff6ee712638e898d4a1da29d 100644 (file)
@@ -554,8 +554,9 @@ gtk_search_entry_init (GtkSearchEntry *entry)
   GtkWidget *icon;
   GtkGesture *press;
 
+  /* The search icon is purely presentational */
   icon = g_object_new (GTK_TYPE_IMAGE,
-                       "accessible-role", GTK_ACCESSIBLE_ROLE_NONE,
+                       "accessible-role", GTK_ACCESSIBLE_ROLE_PRESENTATION,
                        "icon-name", "system-search-symbolic",
                        NULL);
   gtk_widget_set_parent (icon, GTK_WIDGET (entry));
@@ -570,7 +571,10 @@ gtk_search_entry_init (GtkSearchEntry *entry)
   g_signal_connect (entry->entry, "notify", G_CALLBACK (notify_cb), entry);
   g_signal_connect (entry->entry, "activate", G_CALLBACK (activate_cb), entry);
 
-  entry->icon = gtk_image_new_from_icon_name ("edit-clear-symbolic");
+  entry->icon = g_object_new (GTK_TYPE_IMAGE,
+                              "accessible-role", GTK_ACCESSIBLE_ROLE_PRESENTATION,
+                              "icon-name", "edit-clear-symbolic",
+                              NULL);
   gtk_widget_set_tooltip_text (entry->icon, _("Clear entry"));
   gtk_widget_set_parent (entry->icon, GTK_WIDGET (entry));
   gtk_widget_set_child_visible (entry->icon, FALSE);